unit Form_Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, rtcInfo, rtcConn, rtcTcpSrv, StdCtrls;

type
  TForm1 = class(TForm)
    RtcTcpServer1: TRtcTcpServer;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure RtcTcpServer1DataReceived(Sender: TRtcConnection);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  RtcTcpServer1.ServerAddr:='192.168.0.51';
  RtcTcpServer1.ServerPort:='906';
  RtcTcpServer1.Listen();
  Caption:=Format('listen at :%S',[RtcTcpServer1.ServerPort]);
end;

procedure TForm1.RtcTcpServer1DataReceived(Sender: TRtcConnection);
var
  TempA:string;
begin
  TempA:=Sender.read;
  Writeln(TempA);

  //if TempA<>'' then
  begin
    Sender.Write('good bye bady.');
  end;

end;

end.
 